package com.qf.aop2204.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * 基于注解的aop切面实例
 */
//@Aspect
//@Component
public class AnnotationAspectDemo {
    @Around("@annotation(org.springframework.web.bind.annotation.GetMapping)")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("~~~~~~~~~~~~~~~~~");
        long start = System.currentTimeMillis();
        Object result = pjp.proceed();
        System.out.println("~~~~~~~~~~~~~~~~~");
        long end = System.currentTimeMillis();
        System.out.println("time used->"+(end-start));
        return result;
    }
}
